<#import "macros.ftl" as godt>
<html>
	<head>
		<title>${component.name}</title>
		<link rel="stylesheet" href="../../css/reset.css" />
		<link rel="stylesheet" href="../../css/text.css" />
		<link rel="stylesheet" type="text/css" href="../../css/godt.css" />
		<link rel="stylesheet" href="../../css/960.css" />
		
	</head>
	<body>
		<div class="container_12">
			<div class="grid_12 border_rounded">
				<h1><strong>${component.name}</strong></h1>			
			</div>		
			<div class="clear"></div>
			<div class="grid_12 title">
				<h3><strong>General Properties</strong></h3>
			</div>
			<div class="clear"></div>
			<div class="grid_6 central">
				Type: <em>${component.type}</em><br/>
				Loader: <em>${component.loader}</em><br/>
				Location: <em>${component.location}</em>				
			</div>
			<div class="grid_6 central">
				Description: <em>${component.description}</em><br/>
				Vendor: <em>${component.vendor}</em><br/>
				Version: <em>${component.version}</em><br/>
				Created: <em>${component.created}</em>
			</div>
			<div class="clear"></div>
			<#list component.services as service>
				<div class="grid_12 title">
					<a name="${service.name?default('')}"></a>
					<h3><strong>${service.name?default('')}</strong></h3>
				</div>
				<div class="clear"></div>
				<div class="grid_12 description">
					${service.description?default('')}
				</div>
				<div class="clear"></div>
				<div class="grid_6 lateral">					
					Location: <em>${service.location}</em><br/>
					Invoke: <em>${service.invoke}</em><br/>
					Engine: <em>${service.engine}</em><br/>
					Default Entity Name: <em>${service.defaultEntityName}</em><br/>
					Namespace: <em>${service.nameSpace}</em><br/>
					Implements:	 <em>${service.implementService}</em> <#if service.optionalImplementService> (optional) </#if><br/>
					Uses transaction: <em>${service.useTransaction}</em><br/>
					Requires New Transaction: <em>${service.requireNewTransaction}</em><br/>
				</div>
				<div class="grid_6 lateral">		
					Transaction Timeout: <em>${service.transactionTimeOut}</em><br/>					
					Auth: <em>${service.auth}</em><br/>
					Export: <em>${service.export}</em><br/>
					Validate: <em>${service.validate}</em><br/>
					Max retries:<em>${service.maxRetry}</em><br/>	 
					Semaphore:<em>${service.semaphore}</em><br/>
					Semaphore wait seconds:<em>${service.semaphoreWaitSeconds}</em><br/>
					Semaphore Sleep:<em>${service.semaphoreSleep}</em><br/> 
				</div>
				<div class="clear"></div>
				<#if service.permissionService?exists && (service.permissionService.serviceName?exists
					|| service.permissionService.mainAction?exists || service.permissionService.resourceDescription?exists)>
					<div class="grid_12 central">
						Service name: <em>${service.permissionService.serviceName?default('')}</em><br/>
						Resource description:<em>${service.permissionService.resourceDescription?default('')}</em><br/>
						Main action: <em>${service.permissionService.mainAction?default('')}</em><br/>
					</div>
					<div class="clear"></div>
				</#if>
				<#list service.requiredPermissions as permission>
					<div class="grid_12 central">
						Join type: ${permission.joinType}
					</div>
					<div class="clear"></div>
					<#list permission.checkPermissions?chunk(3) as row>
						<#list row as check>
							<div class="grid_4 lateral">
								Permission: ${check.permission}
								Action: ${check.action}
							</div>
						</#list>
						<div class="clear"></div>
					</#list>
					<#list permission.rolePermissions?chunk(3) as row>
						<#list row as role>
							<div class="grid_4 lateral">
								Role: ${role.roleType}
							</div>
						</#list>
						<div class="clear"></div>
					</#list>
				</#list>
				<#if service.autoAttributes?size gt 0>
					<div class="grid_12 views">
						<table>
							<tr>
								<th colspan="6">Auto Attributes</th>
							</tr>
							<tr>
								<th>Entity Name</th>
								<th>Include</th>
								<th>Mode</th>
								<th>Optional</th>
								<th>Form Display</th>
								<th>Allow HTML</th>
							</tr>
							<#list service.autoAttributes as attribute>
								<tr>
									<td>${attribute.entityName}</td>
									<td>${attribute.include}</td>
									<td>${attribute.mode}</td>
									<td>${attribute.optional}</td>
									<td>${attribute.formDisplay}</td>
									<td>${attribute.allowHtml}</td>	
								</tr>
								<#if attribute.excludes?size gt 0 >
								<tr>
									<td>
										<strong>Excludes:</strong>
										<ul>
											<#list attribute.excludes as exclude>
												<#if exclude?exists>
													<li>${exclude}</li>
												</#if>
											</#list>
										</ul>
									</td>
								</tr>
								</#if>
							</#list>
						</table>
					</div>
					<div class="clear"></div>
				</#if>
				<#if service.attributes?size gt 0>
					<div class="grid_12 views">
						<table>
							<tr>
								<th colspan="12">Attributes</th>
							</tr>
							<tr>
								<th>Entity Name</th>
								<th>Name</th>
								<th>Type</th>
								<th>Mode</th>
								<th>Default Value</th>
								<th>Form Label</th>
								<th>Field name</th>
								<th>String map prefix</th>
								<th>String list suffix</th>
								<th>Optional</th>
								<th>Form Display</th>
								<th>Allow HTML</th>
							</tr>
							<#list service.attributes as attribute>
								<tr>
									<td>${attribute.entityName}</td>
									<td>${attribute.name}</td>
									<td>${attribute.type}</td>
									<td>${attribute.mode}</td>
									<td>${attribute.defaultValue}</td>
									<td>${attribute.formLabel}</td>
									<td>${attribute.fieldName}</td>
									<td>${attribute.stringMapPrefix}</td>
									<td>${attribute.stringListSuffix}</td>
									<td>${attribute.optional}</td>
									<td>${attribute.formDisplay}</td>
									<td>${attribute.allowHtml}</td>
								</tr>
								<#if attribute.typesValidate?size gt 0 >
								<tr>
									<td>
										<strong>Type Validate:</strong>
										<table>
											<tr>
												<th>Class</th>
												<th>Method</th>
												<th>Fail Message</th>
												<th>Fail Resource</th>
												<th>Fail Property</th>
											</tr>
											<#list attribute.typesValidate as type>
												<td>
													<td>${type.clazz}</td>
													<td>${type.method}</td>
													<td>${type.failMessage}</td>
													<td>${type.failResource}</td>
													<td>${type.failProperty}</td>
												</td>
											</#list>
										</table>
									</td>
								</tr>
								</#if>
							</#list>						
						</table>
					</div>
					<div class="clear"></div>
				</#if>
				<#if service.overrides?size gt 0>
					<div class="grid_12 views">
						<table>
							<tr>
								<th colspan="10">Overrides</th>
							</tr>
							<tr>
								<th>Entity Name</th>
								<th>Name</th>
								<th>Type</th>
								<th>Mode</th>
								<th>Default Value</th>
								<th>Form Label</th>
								<th>Field name</th>							
								<th>Optional</th>
								<th>Form Display</th>
								<th>Allow HTML</th>
							</tr>
							<#list service.overrides as attribute>
								<tr>
									<td>${attribute.entityName}</td>
									<td>${attribute.name}</td>
									<td>${attribute.type}</td>
									<td>${attribute.mode}</td>
									<td>${attribute.defaultValue}</td>
									<td>${attribute.formLabel}</td>
									<td>${attribute.fieldName}</td>
									<td>${attribute.optional}</td>
									<td>${attribute.formDisplay}</td>
									<td>${attribute.allowHtml}</td>
								</tr>
								<#if attribute.typesValidate?size gt 0 >
								<tr>
									<td>
										<strong>Type Validate:</strong>
										<table>
											<tr>
												<th>Class</th>
												<th>Method</th>
												<th>Fail Message</th>
												<th>Fail Resource</th>
												<th>Fail Property</th>
											</tr>
											<#list attribute.typesValidate as type>
												<td>
													<td>${type.clazz}</td>
													<td>${type.method}</td>
													<td>${type.failMessage}</td>
													<td>${type.failResource}</td>
													<td>${type.failProperty}</td>
												</td>
											</#list>
										</table>
									</td>
								</tr>
								</#if>
							</#list>						
						</table>
					</div>
					<div class="clear"></div>
				</#if>
			</#list>
		</div>
	</body>
<html>